{extend name="public/base"/}
{block name="body"}
<div class="main-box no-header clearfix">
    <header class="main-box-header clearfix">
        <div class="pull-left">
            <h2>{$meta_title}（{$count}）</h2>
        </div>
        <div class="pull-right">
            <a href="{:url('add')}" class="btn btn-primary "> 新增</a>
        </div>
    </header>
    <div class="main-box-body clearfix">
        <div class="row">
          <div class="col-sm-12" style="    margin-bottom: 20px;">
            <div class="btn-group" role="group" aria-label="...">
              {volist name="catlist" id="vo"}
                <a href="{:url('goods/dsj')}?category={$key}" data-id="{$key}" class=" btncatid btn btn-success"  >{$vo}</a>
              {/volist}
            </div>
          </div>
            <form method="get" id="formselect">

                <div class="col-sm-12 col-md-4 col-lg-2">
                    <input type="text" class="form-control" name="keyword" value="" placeholder="请输入关键字">
                </div>
                <div class="col-sm-12 col-md-4">
                    <button class="btn btn-primary" type="submit">搜索</button>
                </div>
            </form>
        </div>

        <script>
            $(function(){
                $('[name="category"]').change(function(){
                    $('#formselect').submit();
                })
            })
        </script>

        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th width="30"><input class="checkbox check-all" type="checkbox"></th>
                <th width="60">ID</th>
                <th>商品图片</th>
                <th>标题</th>
                <th>分类</th>
                <th>特色描述</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="list" id="item"}
            <tr>
                <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$item['id']}"></td>
                <td>{$item['id']}</td>
                <td><img src="{$item['cover_id']|get_cover='path','96x50'}" width="96" height="50" /></td>
                <td>{$item['good_name']} <br /><br />
                    {volist name="$item['goodsrule']" id="vo" }
                    <p>规格：{$vo[rule_name]} 价格：{$vo[rule_price]}元 库存：{$vo[stock] >10 ? $vo[stock] : $vo[stock].'<span style="font-size: 16px;color: red;">(库存不足！)</span>'} 重量：{$vo[weight]}/斤 </p>
                    {/volist}
                </td>
                <td>{$item['cat_id']|get_table_field="id","cat_name","goodscat"}</td>
                <td>{$item['good_desc']|msubstr=###,0,10}</td>
                <td>
                    <a href="{:url('updateFieldById', ['id'=>$item['id'], 'field'=>'sort', 'value'=> '0'])}" class="ajax-get">刷新</a>
                    <a href="{:url('edit',array('id'=>$item['id']))}">编辑</a>
                    <a href="{:url('editStatus',array('id'=>$item['id'], 'status'=>1))}" class="confirm ajax-get">上架</a>
                    <a href="{:url('del',array('id'=>$item['id']))}" class="confirm ajax-get">删除</a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
        {$list->render()}
    </div>
</div>
</div>
{/block}
{block name="script"}


{/block}
